#pragma once

#include "FXValue.h"
/**
* Wrapper around a float2 (x,y)
* @author Koen Samyn
*/
class DAEFloat2: public FXValue
{
public:
	/**
	* Creates a new DAEFloat2 object with values [0,0]
	*/ 
	DAEFloat2();
	/**
	* Creates a new DAEFloat2 object.
	* @param x the initial x value.
	* @param y the initial y value.
	*/
	DAEFloat2(float x, float y);
	/**
	* Normalize the x and y value.
	* Length of this DAEFloat2 will be one after this operation.
	*/
	void Normalize();
	/**
	* Sets the values for this DAEFloat2 object.
	* @param x the new value for the x member.
	* @param y the new value for the y member.
	*/
	void SetValues(float x, float y){
		this->x = x;
		this->y = y;
	}

	/**
	* Clamps the values in this DAEFloat2 to a give range.
	* @param min the minimum allowable value.
	* @param max the maximum allowable value.
	*/
	void Clamp(float min, float max){
		if ( x > max) 
			x = max;
		else if ( x < min)
			x = min;

		if (y > max)
			y = max;
		else if (y < min)
			y = min;
	}

	/**
	* Returns the size of the value in bytes.
	* @return the size in bytes.
	*/
	virtual int GetSizeInBytes() const{
		return 2*sizeof(float);
	}
	/**
	* Returns the pointer to the beginning of the value.
	* @return a void pointer to the beginning of the value.
	*/
	virtual const void* GetValuePointer() const{
		return &x;
	}

	/**
	* the data members.
	*/
	float x,y;
};
